package StudyCode.summary.Basic.stringbuilder;

/**
 * 版权所有 科技与人文(www.tah1986.com)
 */
public class StringBuilderMethods2 {
	public static void main(String[] args) {
		Object objectRef = "hello";
		String string = "world";
		char[] charArray = {'a', 'b', 'c', 'd', 'e', 'f'};
		boolean booleanValue = true;
		char characterValue = 'K';
		int integerValue = 7;
		long longValue = 10000000;
		float floatValue = 2.5f;
		double doubleValue = 33.333;

		StringBuilder stringBuilder = new StringBuilder();

		stringBuilder.insert(0, objectRef).insert(0, "  ").insert(0, string).insert(0, "  ")
				.insert(0, charArray).insert(0, "  ").insert(0, charArray, 3, 3)
				.insert(0, "  ").insert(0, booleanValue).insert(0, "  ").insert(0, characterValue)
				.insert(0, "  ").insert(0, integerValue).insert(0, "  ").insert(0, longValue)
				.insert(0, "  ").insert(0, floatValue).insert(0, "  ").insert(0, doubleValue);

		System.out.printf("stringBuilder 插入后:\n%s\n\n", stringBuilder.toString());

		stringBuilder.deleteCharAt(10);
		stringBuilder.delete(2, 6);

		System.out.printf("stringBuilder 删除后:\n%s\n", stringBuilder.toString());
	}
}
